<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ include file="/resource/common.jsp"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>${title}</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<script type="text/javascript">
		//分页
		function _goto(pageIndex){
			//var _url="<c:url value='/oper/query/@.html'/>".replace("@",pageIndex);
			//$("#query_form").attr("action",_url);
			//$("#query_form").submit();
			
			$('#test').datagrid('load',{
				userid:$('#userid').val(),
				uname:$('#uname').val(),
				opertime1:$('#opertime1').val(),
				opertime2:$('#opertime2').val()
			});
		}
		$(function(){
			$("#query_form").css({"width":$(window).width()});
			$('#test').datagrid({
				//title:'My DataGrid',
				iconCls:'icon-save',
				width:$(window).width(),
				height: $(window).height()-42,
				nowrap: true,
				//autoRowHeight: false,
				striped: true,
				//collapsible:true,
				url:'<%=path%>/oper/query/list.json',
				//sortName: 'code',
				//sortOrder: 'desc',
				//remoteSort: false,
				singleSelect:'true',
				fitColumns:'true',
				onLoadSuccess:function(data){
					$(this).datagrid('doCellTip',{'max-width':'300px','delay':500});
				},
				idField:'dbId',
				queryParams:{
					opertime1:$('#opertime1').val(),
					opertime2:$('#opertime2').val()
					},
				columns:[
				  [	
				  	{title:'警号',field:'userid',width:60,sortable:true,align:'left',fixed:'true'},
				  	{field:'dbId',title:'dbId',align:'left',hidden:'true'},
				  	{field:'uname',title:'用户名称',width:50,align:'left'},
			      	{field:'deptName',title:'用户部门',width:170,align:'left'},
			      	{field:'modname',title:'操作模块',width:50,align:'left'},
			      	{field:'content',title:'操作内容',width:90,align:'left'},
		      		{field:'opertime',title:'操作时间',width:102,align:'left',
		      			formatter:function(value)
		      			{
		      				var tempDate=new Date(value);
			      			return tempDate.toLocaleString();
		      			}
		      		},
					{field:'opt',title:'操作',width:40,align:'center',fixed:'true',
						formatter:function(value,rec){
							return "<a class='href_list' href='javascript:view_snap("+rec.dbId+");'>查看</a>";
						}
					}
				]],
				pagination:true,
				rownumbers:true,
				onLoadSuccess:function(data){
					$(this).datagrid('doCellTip',{'max-width':'300px','delay':500});
				}
				// toolbar:[{
				//	id:'btnadd',
				//	text:'Add',
				//	iconCls:'icon-add',
				//	handler:function(){
				//		$('#btnsave').linkbutton('enable');
				//		alert('add');
				//	}
				//},'-',{
				//	id:'btndelte',
				//	text:'delete',
				//	iconCls:'icon-remove',
				//	handler:function(){
				//		$('#btnsave').linkbutton('enable');
				//		var row=$("#test").datagrid('getSelected');
				//		var dbid=row.dbId;
				//		art.dialog.confirm("是否确认删除当条记录	?",function()
				//		{
				//			$.ajax({
				//				url:"<%=path%>/oper/deleteSysLog/"+dbid+".json",
				//				success:function(result){
				//					if(result)
				//					{
				//						art.dialog.tips("删除成功!");
				//					}
				//					else
				//					{
				//						art.dialog.tips("删除失败!");
				//					}
				//				},
				//				error:function(){
				//				art.dialog.tips("删除失败!");
				//				}
				//			});
				//		});
				//	}
				//},'-',{
				//	id:'btnsave',
				//	text:'Save',
				//	disabled:true,
				//	iconCls:'icon-save',
				//	handler:function(){
				//		$('#btnsave').linkbutton('disable');
				//		
				//	}
				//}] 
			});
			var p = $('#test').datagrid('getPager');
			$(p).pagination({
				onBeforeRefresh:function(){
					///alert('before refresh');
				}
			});
		

		});
		
		function view_snap(logId)
		{
			var url = parent.formateUrl("oper/log/@.html").replace("@", logId);
			var options = {
					w:860,h:520,title:"日志详细信息",id:"log"
			}
			
			
			top.showWin(url,options)
			return ;
			art.dialog.open(ROOT_PATH+"oper/log/@.html".replace("@", logId), {
				title : "日志详细信息",
				lock : true,
				width : 830,
				height : 490,
				fixed : true,
				resize : false,
				cancel : true
			});
		}
	</script>  
</head>
<body style="margin:0 auto;">
 	<div>
		<div>
			<form id="query_form" method="post"   >
			 		
<table width="100%" border="0" cellspacing="0" cellpadding="4" style="background:#e9f8ff; border:1px solid #cbd9e4; font-size:14px;">
<tr>
			    		<td class="td_label">警号</td>
			    		<td class="td_text02"><input type="text" class="input1" id="userid" name="userid" style="width:120px;" value="" maxlength="8" onblur="this.value=this.value.replace(/[^0-9]/g,'');"/></td>
			    		<td class="td_label"   >姓名</td>
			    		<td class="td_text02" ><input type="text" class="input1" id="uname" name="uname" style="width:120px;" value="" maxlength="15" onblur="this.value=this.value.replace(/[^\w\b\u4e00-\u9fa5]/g,'');"/></td>
			    		<td class="td_label" >时间</td>
			    		<td  class="td_text02" style="width:240px">
			    		<input type="text" id="opertime1" name="opertime1" style="width:100px;cursor: pointer;" readonly="readonly" class="Wdate" value="${nowDate}" onclick="WdatePicker();"/>
			    		至
			    		<input type="text" id="opertime2" name="opertime2" style="width:100px;cursor: pointer;" readonly="readonly" class="Wdate" value="${nowDate}" onclick="WdatePicker();"/>
			    		</td>
			    		<td class="td_label">
							<a onclick="javascript:_goto(1);">查询</a>
			    		</td>
			    		<td>&nbsp;&nbsp;</td>
		    		</tr>
</table>
			</form>
		</div>
		<div id="tbl_container">
		<table id="test"></table>
			
	   	</div>
	   	<div style="clear:both;"></div>
    </div>
</body>
</html>